// declare var
declare global{
     interface Window{
          BMap:any;
          init:any;
     }
}
window.init = window.init || function(){
    
          return new Promise(function (resolve, reject) {
               window.init = function () {
              resolve(window.BMap)
         }
        var script = document.createElement("script");
        script.type = "text/javascript";
        script.src = "http://api.map.baidu.com/api?v=2.0&ak=eGO7kXkPzMCMSyo52xCEuzqqYtBNsvH0&callback=init";
        script.onerror = reject;
        document.head.appendChild(script);
      })
      
}
export  function Map(ak: any) {
return window.init()
}